/**   
 * @Title: MenuBean.java 
 * CopyRight(c)2010-DMX 
 */
package com.dmx.fw.bean;

import java.util.ArrayList;
import java.util.List;

/** 
 * @Description: the bean to showing menu
 * @author: system
 * @date: 2008
 * @version V1.0 
 * 
 */
public class MenuBean implements java.io.Serializable ,Comparable<MenuBean>{
	/** 
	 * <p>Description: default constructor</p> 
	 */
	public MenuBean() {
	}

	/** 
	 * @Fields menuPk: 菜单主键
	 */
	private String menuPk;

	/** 
	 * @Fields description: 菜单的描述，应该使用resourceKey对应的描述信息，如果没有resourceKey对应的值，则使用数据库中的description对应的字段值
	 */
	private String description;

	/** 
	 * @Fields level: 菜单的级别
	 */
	private int level; 

	/** 
	 * @Fields sort: 菜单的排序码
	 */
	private int sort;

	/** 
	 * @Fields checked: 是否被选中
	 */
	private String checked;

	/** 
	 * @Fields isShortcut: 是否有快捷键
	 */
	private String isShortcut;

	/** 
	 * @Fields iconName: 菜单图标的路径
	 */
	private String iconName;

	/** 
	 * @Fields url: 菜单对应的URL
	 */
	private String url;

	/** 
	 * @Fields submenus: 包含的子菜单列表
	 */
	private List submenus = new ArrayList();

	/** 
	 * @Fields resourceKey: 国际化资源key
	 */
	private String resourceKey; 

	/** 
	 * @Fields actived: 是否激活
	 */
	private String actived;

	/** 
	 * @Fields parentMenuId: 父菜单的主键
	 */
	private String parentMenuId;

	/** 
	 * @Fields disIconName: 菜单被禁用时图标的路径
	 */
	private String disIconName;

	/** 
	 * @Fields mouseOverIconName: 移动鼠标显示的图标
	 */
	private String mouseOverIconName; 

	/** 
	 * @Fields shortCutSort: 快捷菜单的顺序
	 */
	private int shortCutSort = 0; 

	/** 
	* <p>Description: compare to sort in collection</p> 
	* @see Comparable 
	*/
	@Override
	public int compareTo(MenuBean other) {
		if (level == other.level) {
			if (sort == other.sort) {
				return 0;
			} else {
				return sort > other.sort ? 1 : -1;
			}
		} else {
			return level > other.level ? 1 : -1;
		}
	}
	
	@Override
	public boolean equals(Object o){
		if(o == null) return false;
		if(this == o) return true;
		if(!( o instanceof MenuBean)) return false;
		MenuBean m = (MenuBean) o;
		if(this.getMenuPk().equals(m.getMenuPk())){ 
			return true;
		}else {
			return false;
		}
		
	}

	/**
	 * @return the menuPk
	 */
	public String getMenuPk() {
		return menuPk;
	}

	/**
	 * @param menuPk the menuPk to set
	 */
	public void setMenuPk(String menuPk) {
		this.menuPk = menuPk;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the level
	 */
	public int getLevel() {
		return level;
	}

	/**
	 * @param level the level to set
	 */
	public void setLevel(int level) {
		this.level = level;
	}

	/**
	 * @return the sort
	 */
	public int getSort() {
		return sort;
	}

	/**
	 * @param sort the sort to set
	 */
	public void setSort(int sort) {
		this.sort = sort;
	}

	/**
	 * @return the checked
	 */
	public String getChecked() {
		return checked;
	}

	/**
	 * @param checked the checked to set
	 */
	public void setChecked(String checked) {
		this.checked = checked;
	}

	/**
	 * @return the isShortcut
	 */
	public String getIsShortcut() {
		return isShortcut;
	}

	/**
	 * @param isShortcut the isShortcut to set
	 */
	public void setIsShortcut(String isShortcut) {
		this.isShortcut = isShortcut;
	}

	/**
	 * @return the iconName
	 */
	public String getIconName() {
		return iconName;
	}

	/**
	 * @param iconName the iconName to set
	 */
	public void setIconName(String iconName) {
		this.iconName = iconName;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return the submenus
	 */
	public List getSubmenus() {
		return submenus;
	}

	/**
	 * @param submenus the submenus to set
	 */
	public void setSubmenus(List submenus) {
		this.submenus = submenus;
	}

	/**
	 * @return the resourceKey
	 */
	public String getResourceKey() {
		return resourceKey;
	}

	/**
	 * @param resourceKey the resourceKey to set
	 */
	public void setResourceKey(String resourceKey) {
		this.resourceKey = resourceKey;
	}

	/**
	 * @return the actived
	 */
	public String getActived() {
		return actived;
	}

	/**
	 * @param actived the actived to set
	 */
	public void setActived(String actived) {
		this.actived = actived;
	}

	/**
	 * @return the parentMenuId
	 */
	public String getParentMenuId() {
		return parentMenuId;
	}

	/**
	 * @param parentMenuId the parentMenuId to set
	 */
	public void setParentMenuId(String parentMenuId) {
		this.parentMenuId = parentMenuId;
	}

	/**
	 * @return the disIconName
	 */
	public String getDisIconName() {
		return disIconName;
	}

	/**
	 * @param disIconName the disIconName to set
	 */
	public void setDisIconName(String disIconName) {
		this.disIconName = disIconName;
	}

	/**
	 * @return the mouseOverIconName
	 */
	public String getMouseOverIconName() {
		return mouseOverIconName;
	}

	/**
	 * @param mouseOverIconName the mouseOverIconName to set
	 */
	public void setMouseOverIconName(String mouseOverIconName) {
		this.mouseOverIconName = mouseOverIconName;
	}

	/**
	 * @return the shortCutSort
	 */
	public int getShortCutSort() {
		return shortCutSort;
	}

	/**
	 * @param shortCutSort the shortCutSort to set
	 */
	public void setShortCutSort(int shortCutSort) {
		this.shortCutSort = shortCutSort;
	}

}
